﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

[TestClass()]
public class RegularExpressionsExercisesTest
{


    private TestContext testContextInstance;

    public TestContext TestContext
    {
        get
        {
            return testContextInstance;
        }
        set
        {
            testContextInstance = value;
        }
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberTestZero()
    {
        string number = "0"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
     public void IsRealNumberTestPositiveInteger()
    {
        string number = "33"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
      public void IsRealNumberTestNegativeReal()
    {
        string number = "-2381.78132"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberTestPositiveRealGreaterThan1()
    {
        string number = "4.3347"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
        public void IsRealNumberTestPositiveIntegerPartialized()
    {
        string number = "12.00"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
     public void IsRealNumberTestPositiveRealLessThan1()
    {
        string number = "0.34"; 
        bool expected = true; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
     public void IsRealNumberTestPositiveIntegerPlus()
    {
        string number = "+3"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberTestTwoMinuses()
    {
        string number = "--2"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
      public void IsRealNumberWithIntervals()
    {
        string number = "24 543"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberPositiveRealGreaterThan1WithLeadingZero()
    {
        string number = "01.23"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
     public void IsRealNumberExponential()
    {
        string number = "12е7"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
       public void IsRealNumberNumberWithComma()
    {
        string number = "11,23"; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberNumberEndingWithDot()
    {
        string number = "12."; 
        bool expected = false; 
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [DeploymentItem("RegularExpressions.exe")]
    public void IsRealNumberNegativeZero()
    {
        string number = "-0";
        bool expected = false;
        bool actual;
        actual = Exercises_Accessor.IsRealNumber(number);
        Assert.AreEqual(expected, actual);
    }
}


/*
 * "0", "33", "-2381.78132", "4.3347", "12.00" and "0.34" are valid, 
 * but "+3", "--2", "24 543", "01.23", "12.", "11,23" and "12е7" are invalid
 */
